<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="utf-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>CRUD代码</title>
  <!-- 新 Bootstrap 核心 CSS 文件 -->
  <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap.min.css">
  <!-- 可选的Bootstrap主题文件（一般不用引入） -->
  <link rel="stylesheet" href="//cdn.bootcss.com/bootstrap/3.3.5/css/bootstrap-theme.min.css">
  <!-- jQuery文件。务必在bootstrap.min.js 之前引入 -->
  <script src="//cdn.bootcss.com/jquery/1.11.3/jquery.min.js"></script>
  <!-- 最新的 Bootstrap 核心 JavaScript 文件 -->
  <script src="//cdn.bootcss.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
</head>
<body>
  <div class="row" style="margin-top:150px;">
    <div class="col-md-3 col-md-offset-3">
      <div class="panel panel-info">
        <div class="panel-heading">
          <h3 class="panel-title">新增{$modelName}</h3>
        </div>
        <div class="panel-body">
          ${$tableName}Model = M('{$modelName}');<br/>
          <volist name="modelFields" id="vo">
          <if condition="!in_array($vo, $noCodeArr)"> 
          ${$tableName}Model->{$vo} = _;<br/>
          </if>
          </volist>
          ${$tableName}Model->create_time = time();<br/>
          ${$tableName}Model->add();
        </div>
      </div>
    </div>
    <div class="col-md-3">
      <div class="panel panel-info">
        <div class="panel-heading">
          <h3 class="panel-title">修改{$modelName}</h3>
        </div>
        <div class="panel-body">
          ${$tableName}Model = M('{$modelName}');<br/>
          ${$tableName}Model->find($id);<br/>
          <volist name="modelFields" id="vo">
          <if condition="!in_array($vo, $noCodeArr)"> 
          ${$tableName}Model->{$vo} = _;<br/>
          </if>
          </volist>
          ${$tableName}Model->update_time = time();<br/>
          ${$tableName}Model->save();
        </div>
      </div>
    </div>
  </div>
  <hr/>
  <div class="row">
    <div class="col-md-3 col-md-offset-3">
      <div class="panel panel-info">
        <div class="panel-heading">
          <h3 class="panel-title">删除{$modelName}</h3>
        </div>
        <div class="panel-body">
          ${$tableName}Model = M('{$modelName}');<br/>
          ${$tableName}Model->delete($id);<br/>
        </div>
      </div>
    </div>
    <div class="col-md-3">
      <div class="panel panel-info">
        <div class="panel-heading">
          <h3 class="panel-title">查询{$modelName}</h3>
        </div>
        <div class="panel-body">
          ${$tableName}Model = M('{$modelName}');<br/>
          $list = ${$tableName}Model->select();<br/>
        </div>
      </div>
    </div>
  </div>
</body>
</html>